import { reqGoodsListInfo } from "@/api"
const state ={
    goodsListInfo:[]
}
const mutations={
    RES_GOODSLIST(state,goodsListInfo){
        state.goodsListInfo = goodsListInfo
    }

}
const actions={
    async getGoodsListInfo({commit},searchParams){
        const result = await reqGoodsListInfo(searchParams)
        if(result.code === 200){
            commit('RES_GOODSLIST',result.data)
        }
    }
}
const getters={
    attrsList(state){
        return state.goodsListInfo.attrsList || []
    },
    goodsList(state){
        return state.goodsListInfo.goodsList || []
    },
    trademarkList(state){
        return state.goodsListInfo.trademarkList || []
    },
    total(state){
        return state.goodsListInfo.total || 0
    }
}
export default {
    state,
    mutations,
    actions,
    getters
}
